<template>
	<view class="content">
		<view class="header">
			<view class="header-title">
				情感通道
			</view>
			<view class="header-context">
				<view class="item">
					<view class="image" @click="goPubVideo">
						<image mode="aspectFit" style=" text-align: center; width: 60rpx; height: 60rpx;" shape="circle" src="@/static/img/home111_0005_图层-4.png"></image>
					</view>
					
					<view class="item-content">发布视屏</view>
				</view>
				<view class="item">
					<view class="image">
						<image mode="aspectFit" style="width: 60rpx; height: 60rpx;" shape="circle" src="@/static/img/home111_0002_图层-7.png"></image>
					</view>
					
					<view class="item-content">发布信件</view>
				</view>
				<view class="item">
					<view class="image">
						<image mode="aspectFit" style="width: 60rpx; height: 60rpx;" shape="circle" src="@/static/img/home111_0003_图层-6.png"></image>
					</view>

					<view class="item-content">做客走访</view>
				</view>
				<view class="item">
					<view class="image"><image mode="aspectFit" style="width: 60rpx; height: 60rpx;" shape="circle" src="@/static/img/home111_0004_图层-5.png"></image></view>
					
					<view class="item-content">感谢证书</view>
				</view>
			</view>
		</view>
		<view class="body">
			<view class="body-pub">
				<view class="pub-title">
					<view style="margin-top: 7rpx; height: 45rpx; width: 8rpx; background-color: #D5A6A5;"></view>
					<view style="line-height: 55rpx; font-size: 30rpx; font-weight: bolder; margin-left: 20rpx; letter-spacing: 8rpx; ">已发布</view>
					<view @click="pubShowClick">
						<image style="height: 60rpx; width: 60rpx;" :src="pubUpImg"></image>
					</view>
				</view>
				<view class="pub-content" v-if="pubShow">
					<scroll-view
					enable-flex="true"
					style="white-space: nowrap; min-height: 100rpx; max-height: 78vh; height: auto;" 
					scroll-y="true">
							<view class="content-item" v-for="(item, index) in pubList" :key = "index">
								<view class="content-detail">
									● {{item.time}}：{{item.title}}
								</view>
								
								<view class="content-type">
									<image mode="aspectFit" style="height: 40rpx; width: 40rpx;" :src="item.type == 'video' ? videoImg : letterImg"></image>
								</view>
							</view>
					</scroll-view>
				</view>
			</view>
			
			<view class="body-rec">
				<view class="rec-title">
					<view style="margin-top: 7rpx; height: 45rpx; width: 8rpx; background-color: #D5A6A5;"></view>
					<view style="line-height: 55rpx; font-size: 30rpx; font-weight: bolder; margin-left: 20rpx; letter-spacing: 8rpx; ">收到的信件</view>
					<view @click="recShowClick">
						<image style="height: 60rpx; width: 60rpx;" :src="recUpImg"></image>
					</view>
				</view>
				<view class="rec-content" v-if="recShow">
					<scroll-view
					enable-flex="true"
					style="white-space: nowrap; min-height: 100rpx; max-height: 78vh; height: auto;" 
					scroll-y="true">
							<view class="content-item" v-for="(item, index) in recList" :key = "index">
								<view class="content-detail">
									● {{item.time}}：{{item.title}}
								</view>
								
								<view class="content-type">
									<image mode="aspectFit" style="height: 40rpx; width: 40rpx;" :src="item.type == 'video' ? videoImg : letterImg"></image>
								</view>
							</view>
					</scroll-view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				recShow: true,
				recUpImg: "../../static/img/up.png",
				recList: [{time: "1月4日", title: "来自云宇宙社区的感谢信", type: "letter"},
							{time: "2月5日",title: "来自星星社区的感谢证书", type: "letter"},
						],
				pubShow: true,
				pubUpImg: "../../static/img/up.png",
				pubList: [{time: "1月4日",title: "记录公益点滴生活", type: "video"},{time: "2月5日",title: "发送给云宇宙社区的信件"}],
				videoImg: "../../static/img/home111_0000_图层-9.png",
				letterImg: "../../static/img/home111_0001_图层-8.png",
			}
		},
		methods: {
			pubShowClick() {
				if(this.pubShow == true) {
					this.pubUpImg = "../../static/img/down.png";
					this.pubShow = false;
				} else {
					this.pubUpImg = "../../static/img/up.png";
					this.pubShow = true;
				}
			},
			recShowClick() {
				if(this.recShow == true) {
					this.recUpImg = "../../static/img/down.png";
					this.recShow = false;
				} else {
					this.recUpImg = "../../static/img/up.png";
					this.recShow = true;
				}
			},
			goPubVideo() {
				uni.navigateTo({
					url: "../pubVideo/pubVideo"
				})
			}
		}
	}
</script>

<style lang="scss">
  .content {
		background-image: linear-gradient( to bottom , #FDECEA, #d6d8ec);
		height: auto;
		min-height: 100vh;
		padding: 1rpx;
		.header {
			text-align: center;
			margin-top: 30rpx;
			padding: 1rpx;
			.header-title {
				text-align: center;
				letter-spacing: 5rpx;
				font-size: 50rpx;
				font-weight: bolder;
				font-family: Monospace;
			}
			.header-context {
				height: 330rpx;
				text-align: center;
				margin: 20rpx 60rpx 20rpx 60rpx;
				background-color: rgba(253, 253, 253, 0.5);
				border-radius: 60rpx;
				box-shadow: 0 0 10px 5px rgba(217, 217, 217, 0.3);
				display: flex;
				.item {
					height: auto;
					width: 25%;
					padding: 30rpx 0 0 0;
					text-align: center;
					border-radius: 5rpx;
					.item-content {
						padding: 10rpx 0 0 0;
						padding-left: 60rpx;
						font-size: 30rpx;
						text-align: center;
						height: 80%;
						width: 4rpx;
					}
					.image {
						margin-left: 30rpx;
						height: 90rpx;
						width: 90rpx;
						background-color: rgba(253, 253, 253, 0.1);
						border-radius: 50%;
						border: 1rpx solid #85a2cd;
						padding-top: 15rpx;
					}
				}
			}
			
		}
		.body {
			margin: 10rpx 60rpx 30rpx 60rpx;
			.body-pub {
				.pub-title {
					display: flex;
					.title-content {
						margin-left: 10rpx;
						font-size: 36rpx;
						font-weight: bold;
					}
				}
				.pub-content {
					.content-item {
						letter-spacing: 3rpx;
						word-break: break-all;
						min-height: 100rpx;
						height: auto;
						width: 100%;
						background-color: white;
						border-radius: 60rpx;
						margin-bottom: 28rpx;
						padding: 20rpx 30rpx 20rpx 25rpx;
						line-height: 50rpx;
						white-space: pre-wrap;
						word-wrap: break-word;
						display: flex;
						align-items: center;     /* 垂直居中 */
						justify-content: center; /* 水平居中 */
						.content-detail {
							margin-right: 10rpx;
							overflow: hidden;
							white-space: nowrap;
							text-overflow: ellipsis;
						}
						.content-type {
							height: 40rpx;
							width: 40rpx;
							margin-left: auto;
						}
					}
				}
			}
			
			.body-rec {
				.rec-title {
					display: flex;
					.title-content {
						margin-left: 10rpx;
						font-size: 36rpx;
						font-weight: bold;
					}
				}
				.rec-content {
					.content-item {
						letter-spacing: 3rpx;
						word-break: break-all;
						min-height: 100rpx;
						height: auto;
						width: 100%;
						background-color: white;
						border-radius: 60rpx;
						margin-bottom: 28rpx;
						padding: 20rpx 30rpx 20rpx 25rpx;
						line-height: 50rpx;
						white-space: pre-wrap;
						word-wrap: break-word;
						display: flex;
						align-items: center;     /* 垂直居中 */
						justify-content: center; /* 水平居中 */
						.content-detail {
							margin-right: 10rpx;
							overflow: hidden;
							white-space: nowrap;
							text-overflow: ellipsis;
						}
						.content-type {
							height: 40rpx;
							width: 40rpx;
							margin-left: auto;
						}
					}
				}
			}
		}
		
	}
</style>
